<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head></head>
<body>
  <div th:fragment="content">
    <div class="row">
      <div class="col-xs-12">
        <div class="box">
          <div class="box-header">
            <h3 class="box-title">用户信息</h3>
          </div>
          <!-- /.box-header -->
          <div class="box-body">
            <div class="table-responsive">
              <table class="table table-bordered table-striped">
                <tbody>
                  <tr>
                    <th style="width: 150px">用户ID</th>
                    <td th:text="${loginUser.uid}">1</td>
                  </tr>
                  <tr>
                    <th>用户名</th>
                    <td th:text="${loginUser.uname}">admin</td>
                  </tr>
                  <tr>
                    <th>昵称</th>
                    <td th:text="${loginUser.alias}">管理员</td>
                  </tr>
                  <tr>
                    <th>角色</th>
                    <td th:text="${loginUser.role != null ? loginUser.role.rname : '未知'}">管理员</td>
                  </tr>
                  <tr>
                    <th>状态</th>
                    <td th:text="${loginUser.status == 1 ? '正常' : '禁用'}">正常</td>
                  </tr>
                  <tr>
                    <th>最后登录时间</th>
                    <td th:text="${loginUser.last_login_time != null ? loginUser.last_login_time : '无记录'}">2023-05-10</td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <!-- /.box-body -->
        </div>
        <!-- /.box -->
      </div>
      <!-- /.col -->
    </div>
    <!-- /.row -->
    
    <div class="row">
      <div class="col-xs-12">
        <div class="box">
          <div class="box-header">
            <h3 class="box-title">我的文章</h3>
          </div>
          <!-- /.box-header -->
          <div class="box-body">
            <table id="userArticles" class="table table-bordered table-striped">
              <thead>
                <tr>
                  <th>文章ID</th>
                  <th>标题</th>
                  <th>分类</th>
                  <th>发布时间</th>
                  <th>浏览次数</th>
                  <th>状态</th>
                </tr>
              </thead>
            </table>
          </div>
          <!-- /.box-body -->
        </div>
        <!-- /.box -->
      </div>
      <!-- /.col -->
    </div>
    <!-- /.row -->
    
    <script th:inline="none">
      $(function() {
        // 初始化文章表格
        var table = $('#userArticles').DataTable({
          'ajax': '/article/listByUser',
          'paging': true,
          'lengthChange': true,
          'searching': true,
          'ordering': true,
          'info': true,
          'autoWidth': false,
          'language': {
            'lengthMenu': '每页显示 _MENU_ 条记录',
            'zeroRecords': '暂无记录',
            'info': '第 _PAGE_ 页 / 共 _PAGES_ 页',
            'infoEmpty': '暂无记录',
            'infoFiltered': '(从 _MAX_ 条记录中筛选)',
            'search': '搜索:',
            'paginate': {
              'first': '首页',
              'last': '末页',
              'next': '下一页',
              'previous': '上一页'
            }
          }
        });
      });
    </script>
  </div>
</body>
</html> 